import request from '../utils/request'

export const checklogin =(data)=>{
    return request({
        method:'post',
        url:'/users/checkLogin',
        data
    })
}

// 添加账号
export const addAccount = (data) => {
    return request({
        method: 'post',
        url: '/users/add',
        data
    })
}


//获取账号列表
export const getlist = (params) => {
    return request({
        method: 'get',
        url: '/users/list',
        params
    })
}

// 删除账号
export const deleteAccount = (id) => {
    return request({
        method: 'get',
        url: '/users/del',
        params: {
            id,
        }
    })
}

// 获取个人信息
export const getInfo = () => {
    return request({
        method: 'get',
        url: '/users/info',
    })
}

// 批量删除
export const batchDel = (ids) => {
    return request({
        method: 'get',
        url: '/users/batchdel',
        params: {
            ids
        }
    })
}

// 修改账号
export const editAccount = (data) => {
    return request({
        method: 'post',
        url: '/users/edit',
        data
    })
}

// 修改用户头像
export const editAvatar = (imgUrl) => {
    return request({
        method: 'get',
        url: '/users/avataredit',
        params: {
            imgUrl
        }
    })
}

// 旧密码
export const examinePass = (a,b) => {
    return request({
        method: 'get',
        url: '/users/checkoldpwd',
        params:{
            oldPwd:a,
            id:b
        }
    })
}

// 修改密码
export const changePassword = (a,b) => {
    return request({
        method: 'post',
        url: '/users/editpwd',
        data: {
            newPwd:a,
            id:b,
        }
    })
}